fix: restore DevTools client styling under Vite 8 environment builds - #1088
fix: restore DevTools client styling under Vite 8 environment builds#1088antfubot wants to merge 1 commit into
Conversation
The client UI shipped without any UnoCSS utility classes, leaving the whole app unstyled. UnoCSS's global build plugin registers Vite's `vite:css-post` handler keyed by the top-level `build.outDir`, but Vite 8's Environment API builds the client into a per-environment output dir (`.output/public`). The lookup missed, so the generated utility CSS was silently dropped and only the static reset survived. Patch `@unocss/vite` to also register css-post for each environment's `build.outDir`.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Environment-specific Vite build outputs now receive UnoCSS post-processing, restoring generated DevTools client utility styling with no identified remaining merge risk. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
The DevTools client UI renders completely unstyled (serif fallback font, full-size logo, no sidebar layout) on the latest published alpha and on
main. The built client ships none of its UnoCSS utility classes — only the static@unocss/resetsurvives, so every layout/spacing/color/font utility (flex,grid,fixed,w-screen,bg-base,font-sans, …) is missing.Root cause
UnoCSS's global build plugin (
@unocss/vite) registers Vite'svite:css-posthandler keyed by the output directory, building that key set inconfigResolvedfrom the top-levelconfig.build.outDir(which under Nuxt is the default"dist").Vite 8's Environment API, however, builds each environment into its own
build.outDir— the client goes to.output/public. AtrenderChunk,options.diris that per-environment dir, which is never in UnoCSS's key set, so the lookup misses:With no css-post handler found, the freshly generated utility CSS (all ~12.7k tokens) is silently dropped and only the statically-imported reset remains.
This is an upstream
@unocss/vite↔ Vite 8 (multi-environment build) incompatibility; it surfaced once the client moved to the Vite 8 / environment build.Fix
pnpm patchon@unocss/vite@66.10.0that also registers css-post for each environment'sbuild.outDir, in addition to the top-level one. Registered viapatchedDependencies(same mechanism already used for thenitropatch).Dev mode (
nuxi dev client) is unaffected — the patched path isapply: "build"only.Verification
Rebuilding the client (
nuxi generate client):entry.css≈ 10 KB, no utilities present.entry.css= 173 KB, all utilities present andbg-base/n-bg-baseshortcuts resolved.Follow-up
This should be reported/fixed upstream in UnoCSS; the patch is a stopgap pinned to
66.10.0and will need refreshing on the next bump.This PR was created with the help of an agent.